package lab02.test06;

public class Triangle {
    double sideA;
    double sideB;
    double sideC;
    double perimeter;
    double area;
    boolean triangle;

    public Triangle(double a, double b, double c) {
        this.sideA = a;
        this.sideB = b;
        this.sideC = c;
    }

    public void perimeter() {

        perimeter = (sideA + sideB + sideC);
        System.out.println("三角形周长是：" + perimeter);
    }

    public void area() {
        double half = perimeter / 2;
        area = (double) Math.sqrt(half * (half - sideA)
                * (half - sideB) * (half - sideC));
        System.out.println("三角形面积是：" + area);
    }

    public boolean triangle() {
        if (sideA + sideB > sideC && sideA + sideC > sideB &&
                sideB + sideC > sideA) {
            return true;
        } else {
            return false;
        }

    }
}
